package org.currentcost.messages;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class SensorData
{
	private List<ValueData> _dataPoints;

	public void addData(String sensorId, String channelId,
	                    double value, EnviUnit unit, Date startDate, Date endDate)
	{
		_dataPoints.add(new ValueData(sensorId, channelId, value, unit, startDate, endDate));
	}

	public SensorType getSensorType()
	{
		return _type;
	}

	public static enum SensorType
	{
		ELECTRICITY, IMPULSE_ELECTRIC, IMPULSE_GAS, IMPULSE_WATER
	}

	private final SensorType _type;

	public SensorData(SensorType type)
	{
		_type = type;
		_dataPoints = new ArrayList<ValueData>();
	}

	public void addData(String sensorId, String channelId, double value, EnviUnit unit)
	{
		addData(sensorId, channelId, value, unit, null, null);
	}

	public SensorType getType()
	{
		return _type;
	}

	public ValueData[] getDataPoints()
	{
		return _dataPoints.toArray(new ValueData[_dataPoints.size()]);
	}

}
